//在页面未加载完毕之前显示的loading Html自定义内容
var _LoadingHtml = '<div id="loadingDiv" style="display: none; "><div id="over" style=" position: absolute;top: 0;left: 0; width: 100%;height: 100%; background-color: #f5f5f5;opacity:0.5;z-index: 1000;"></div><div id="layout" style="position: absolute;top: 40%; left: 40%;width: 20%; height: 20%;  z-index: 1001;text-align:center;"><img src="./assets/js/loading.gif" /></div></div>';
var _AlertHtml = '<div id="alerDiv" style="display: none; "><div id="over" style=" position: absolute;top: 0;left: 0; width: 100%;height: 100%; background-color: #f5f5f5;opacity:0;z-index: 1000;"></div><div id="layout" style="position: absolute;top: 10%;z-index: 1001;text-align:center;width: 100%;display: flex;justify-content: center;"><p style="background: rgba(39, 40, 46, 0.8);color: white;font-size: 1rem;/* margin: 0.88rem; */padding: 0.88rem;max-width: calc(100% - 60px);width: fit-content;width: -webkit-fit-content;border-radius: 1.53rem;">网络异常，请检查你的网络设置</p></div></div>'

//呈现loading效果
document.write(_LoadingHtml);
document.write(_AlertHtml);

//移除loading效果
function completeLoading()
{
	if (document.getElementById("loadingDiv"))
	{
		document.getElementById("loadingDiv").style.display = "none";
	}
}
//展示loading效果
function showLoading()
{
	if (document.getElementById("loadingDiv"))
	{ // 非空判断
		document.getElementById("loadingDiv").style.display = "block";
	}
	setTimeout(() =>
	{
		completeLoading();
	}, 30000);
}


//移除alert效果
function completeAlert()
{
	if (document.getElementById("alerDiv"))
	{
		localStorage.removeItem('alertNotNetWork')
		document.getElementById("alerDiv").style.display = "none";
	}
}
//展示alert效果
function showAlert()
{
	if (document.getElementById("alerDiv"))
	{ // 非空判断
		document.getElementById("alerDiv").style.display = "block";
	}
	setTimeout(() =>
	{
		completeAlert();
	}, 2000);
}